import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { activitiUtils } from '../../activitiUtils';
//列表
export const columns: BasicColumn[] = [
  {
    title: '标题',
    align:"center",
    dataIndex: 'title'
  },
  {
    title: '所属流程',
    align:"center",
    dataIndex: 'processName'
  },
  {
    title: '当前审批环节',
    align:"center",
    dataIndex: 'currTaskName'
  },
  {
    title: '状态',
    align:"center",
    dataIndex: 'status',
    customRender:({text}) => {
      let arr=['草稿','处理中','已结束','已撤回'];
      return arr[text];
    },
  },
  {
    title: '结果',
    align:"center",
    dataIndex: 'result',
    customRender:({text}) => {
      let arr=['未提交','处理中','通过','驳回'];
      return arr[text];
    },
  },
  {
    title: '创建时间',
    align:"center",
    dataIndex: 'createTime'
  },
  {
    title: '提交申请时间',
    align:"center",
    dataIndex: 'applyTime'
  },
];

//查询
export const searchFormSchema: FormSchema[] = [
  {
    label: '标题',
    field: 'title',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '状态',
    field: 'status',
    component: 'Select',
    colProps: { span: 6 },
    componentProps:{
      options: [
        {label: '草稿', value: '0', key: '0',},
        {label: '处理中', value: '1',key: '1', },
        {label: '已结束', value: '2',key: '2', },
        {label: '已撤回', value: '3',key: '3', },
      ],
    }
  },
  {
    label: '结果',
    field: 'result',
    component: 'Select',
    colProps: { span: 6 },
    componentProps:{
      options: [
        {label: '未提交',value: '0', key: '0'},
        {label: '处理中', value: '1',key: '1', },
        {label: '通过', value: '2',key: '2', },
        {label: '驳回', value: '3',key: '3', },

      ],
    }
  },
  {
    label: "时间",
    field: "createTimeRange",
    component: 'RangePicker',
    componentProps: {
      valueType: 'Date',
      showTime:true
    },
    colProps: {span: 6},
  },
];

//请假表单
export const formSchemaQJ: FormSchema[] = [
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
  {
    label: '请假类型',
    field: 'qjName',
    component: 'Input',
  },
  {
    label: '请假事由',
    field: 'descc',
    component: 'InputTextArea',
  },
  {
    label: '年龄',
    field: 'age',
    component: 'InputNumber',
  },
  {
    label: '请假期间工作处理',
    field: 'chegnshi',
    component: 'InputTextArea',
  },
];
//请假表单
export const formSchemaTJ: FormSchema[] = [
  {
    label: '选择审批人',
    field: 'assignees',
    component: 'Select',
    defaultValue:'',
    componentProps: {
      placeholder:'选择审批人',
      options:[]
    }
  },
  {
    label: '优先级',
    field: 'priority',
    component: 'Select',
    defaultValue:'0',
    componentProps: {
     
      options: [
        {
          label: '普通',
          value: '0',
        },
        {
          label: '重要',
          value: '1',
        },
        {
          label: '紧急',
          value: '2',
        },
      ]
    },
  },
  {
    label: '消息通知',
    field: 'sendMessage',
    component: 'Select',
    defaultValue: true,
    componentProps: {
      options: [
        {
          label: '站内消息通知',
          value: true,
        },
      ]
    },
  },
];

export const formSchemaCancel: FormSchema[] = [
{
  label: '撤回原因',
  field: 'reason',
  component: 'InputTextArea',
},
];

//列表
export const columnsSpDetail: BasicColumn[] = [
  {
    title: '任务名称',
    align:"center",
    dataIndex: 'name'
  },
  {
    title: '处理人',
    align:"center",
    dataIndex: 'assignees',
    customRender:({text}) => {
      return text[0].username;
    },
  },
  {
    title: '审批操作',
    align:"center",
    dataIndex: 'deleteReason'
  },
  {
    title: '审批意见',
    align:"center",
    dataIndex: 'comment'
  },
  {
    title: '耗时',
    align:"center",
    dataIndex: 'duration',
    customRender: activitiUtils.millsToTime
  },
  {
    title: '创建时间',
    align:"center",
    dataIndex: 'createTime'
  },
  {
    title: '完成时间',
    align:"center",
    dataIndex: 'endTime'
  },
  {
    title: '状态',
    align:"center",
    dataIndex: 'endTime',
    customRender:({text}) => {
      return text?'已处理':'待处理';
    },
  },
];




//请假表单
export const searchHistoricFlowDetail: FormSchema[] = [
  {
    label: 'ce',
    field: 'procInstId',
    defaultValue:'1213',
    component: 'Input',
    show: false,
  },
]